package grape.sequence.service.generator.periodparser;

import grape.sequence.service.config.po.Config;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * Created by yangwei
 * Created at 2020/8/20 18:51
 */
public interface IPeriodUnitParser {

    @Data
    public static class ParserResult{
        private String prefix;
        private String period;

        private String full;

        public ParserResult(String prefix, String period) {
            this.prefix = prefix;
            this.period = period;
            this.full = prefix + period;
        }
    }

    /**
     * 根据周期解析
     * @param config
     * @return 返回suffix 一个周期后缀，用来作为表名的一部分，如：如果按年则返回2020，返回按周则返回202022
     */
    ParserResult parse(Config config,Config.PeriodUnitDictItem periodUnitDictItem);

}
